<template>
  <div>
    <el-row style="margin-bottom:20px;display:flex;justify-content:flex-start">
      <el-input
        placeholder="牌照"
        style="width:20%;margin-right:10px"
        v-model="carrecordval.carno"
        clearable
      ></el-input>

      <el-input
        placeholder="行车地点"
        clearable
        style="width:20%;margin-right:10px"
        v-model="carrecordval.useaddress"
      ></el-input>
      <el-input placeholder="司机" style="width:20%;margin-right:10px" v-model="carrecordval.holder" clearable></el-input>

      <el-date-picker
        v-model="carrecordval.recorddate"
        style="width:32%;margin-right:20px"
        type="daterange"
        rangeSeparator="至"
        startPlaceholder="出行开始日期"
        endPlaceholder="出行结束日期"
        valueFormat="yyyy-MM-dd"
        placeholder="出行时间"
        clearable
      ></el-date-picker>
      <el-button size="mini" type="primary" @click="getrecord">搜索</el-button>
    </el-row>

    <el-divider></el-divider>
    <recordtable :tableData="carrecorddata" :pagobj.sync="pagobj"></recordtable>
  </div>
</template>

<script>
import recordtable from '~/components/carmanager/carrecord/recordtable.vue';
import selectcarnumber from '~/components/common/selectcarnumber.vue';

export default {
  components: {
    recordtable,
    selectcarnumber,
  },
  data() {
    return {
      dialogVisible: false,
      ts: this.newStore(),
      carrecorddata: [], // 列表数据
      carrecordval: {
        useaddress: '', // 地址
        recorddate: ['', ''], // 时间
        carno: '', // 车牌val
        holder: '',
      },
      carid: '', // 车牌id
      pagobj: {
        currentPage3: 1,
        pagesize: 10,
        total: 10,
      },
    };
  },
  created() {
    this.getrecord();
  },
  methods: {
    // 获取cardid
    getpersonid2(val) {
      this.carid = val.id2;
      this.carrecordval.carno = val.id;
    },
    // 获取列表
    getrecord() {
      const req = {
        handle: '0E56125B90D2898AD9707FF956BF0EE079D43E62D64A5D24',
        carno: this.carrecordval.carno,
        useaddress: this.carrecordval.useaddress,
        holder: this.carrecordval.holder,
        recordtimes: this.carrecordval.recorddate[0],
        recordtimee: this.carrecordval.recorddate[1],
        start: (this.pagobj.currentPage3 - 1) * this.pagobj.pagesize,
        limit: this.pagobj.pagesize,
      };
      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        if (ts.d.sflag == 'success') {
          this.carrecorddata = ts.d.data.operation1;
          // console.log(this.carrecorddata, "232");
          this.pagobj.total = parseInt(ts.d.data.operation2[0].hash.allrs);
          // this.carlist = {};
        }
      });
    },
  },
};
</script>

